package com.heimatest.test04;

import javax.swing.*;
import java.awt.*;

public class MyJFrame extends JFrame {
    public MyJFrame() {
        init();
    }

    private void init() {
        //标题
        this.setTitle("济南黑马程序员");
        //窗口大小
        this.setSize(600, 400);
        //打开窗口时,窗口所在位置
        this.setLocationRelativeTo(null);
        //禁止拖动调整窗口大小
        this.setResizable(false);
        //点击叉号结束进程
        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);


        //北边创建一个布局存储器
        //边框加流式
        JPanel top = new JPanel();
        top.setLayout(new FlowLayout(FlowLayout.LEFT,130,50));
        JButton jb1 = new JButton("学习前端");
        JButton jb2 = new JButton("学习测试");
        //存入两个按钮
        top.add(jb1);
        top.add(jb2);

        //中间边框布局
        JButton jb3 = new JButton("学习JAVA");


        //南边创建一个布局存储器
        //边框加流式
        JPanel bottom = new JPanel();
        bottom.setLayout(new FlowLayout(FlowLayout.LEFT,130,50));
        JButton jb4 = new JButton("学习PHP");
        JButton jb5 = new JButton("学习大数据");
        //存入两个按钮
        bottom.add(jb4);
        bottom.add(jb5);


        this.add(top,BorderLayout.NORTH);
        this.add(jb3,BorderLayout.CENTER);
        this.add(bottom,BorderLayout.SOUTH);



        //窗口显示
        this.setVisible(true);
    }
}
